package com.xb.loan.cashier.biz.task;


import com.xb.loan.cashier.biz.dao.bean.CashierChargeOrder;
import com.xb.loan.cashier.biz.util.Configure;
import com.xb.loan.util.DateHelper;

import java.util.Date;

/**
 * 第三方充值查询任务
 *
 */
public abstract class ThirdQueryChargeTask extends BaseTask {
    
    protected CashierChargeOrder cashierChargeOrder;

    public CashierChargeOrder getCashierChargeOrder() {
        return cashierChargeOrder;
    }

    public void setCashierChargeOrder(CashierChargeOrder cashierChargeOrder) {
        this.cashierChargeOrder = cashierChargeOrder;
    }
    
    /**
     * 检查订单查询任务返回异常是否超时，超时要处理为失败
     * @return
     */
    public boolean isTimeOut(){
    	int hour = Configure.getIntValue("job.chargequery.timeout");
        Date tempDate = DateHelper.getBeforeHour(new Date(), -hour);
        if (cashierChargeOrder.getCreateTime().before(tempDate)) {//超时
            return true;
        }
        return false;
    }

}
